<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>客服电话设置</title>
    {template 'stourtravel/public/public_min_js'}
    {php echo Common::getCss('style.css,base.css,base_new.css'); }
    {php echo Common::getScript('config.js,product_add.js');}

</head>
<body>

    <table class="content-tab">
        <tr>
            <td width="119px" class="content-lt-td"  valign="top">
                {template 'stourtravel/public/leftnav'}
                <!--右侧内容区-->
            </td>
            <td valign="top" class="content-rt-td">
                <form id="configfrm">
                    <div class="w-set-con">
                        <div class="cfg-header-bar">
                            <div class="cfg-header-tab" id="nav">
                                <span class="item"><s></s>三方客服</span>
                                <span class="item" data-id="wechar"><s></s>微信客服</span>
                                <span class="item" data-id="phone"><s></s>电话客服</span>
                            </div>
                            <a href="javascript:;" class="fr btn btn-primary radius mr-10 mt-6" onclick="window.location.reload()">刷新</a>
                        </div>
                        <div class="w-set-nr">
                            <div class="product-add-div">
                                <ul class="info-item-block">
                                    <li>
                                        <span class="item-hd">三方客服代码{Common::get_help_icon('cfg_m_html_kefu')}：</span>
                                        <div class="item-bd">
                                            <textarea id="cfg_html_kefu" name="cfg_m_html_kefu"  cols="" rows="4" class="textarea w800"></textarea>
                                        </div>
                                    </li>
                                </ul>
                            </div>
                            <div class="product-add-div" data-id="wechar">
                                <ul class="info-item-block">
                                    <li>
                                        <span class="item-hd">客服链接{Common::get_help_icon('cfg_m_wap_link')}：</span>
                                        <div class="item-bd">
                                            <input type="text" name="cfg_m_wap_link" id="cfg_m_wap_link" class="input-text w300" value="{$config['cfg_m_wap_link']}" />
                                        </div>
                                    </li>
                                    <li>
                                        <span class="item-hd">企业ID{Common::get_help_icon('cfg_m_wap_en_id')}：</span>
                                        <div class="item-bd">
                                            <input type="text" name="cfg_m_wap_en_id" id="cfg_m_wap_en_id" class="input-text w300" value="{$config['cfg_m_wap_en_id']}" />
                                        </div>
                                    </li>
                                </ul>
                            </div>
                            <div class="product-add-div" data-id="phone">
                            <ul class="info-item-block">
                                <li>
                                    <span class="item-hd">客服电话{Common::get_help_icon('cfg_m_phone')}：</span>
                                    <div class="item-bd">
                                        <input type="text" name="cfg_m_phone" id="cfg_m_phone" class="input-text w300" value="{$config['cfg_m_phone']}" />
                                    </div>
                                </li>
                            </ul>
                            </div>
                            <div class="clear clearfix">
                                <a class="btn btn-primary size-L radius w100 ml-115" href="javascript:;" id="btn_save">保存</a>
                                <input type="hidden" name="webid" id="webid" value="0">
                            </div>
                        </div>
                    </div>
                </form>
            </td>
        </tr>
    </table>


    <script>
        $(document).ready(function () {
            //配置信息保存
            $("#btn_save").click(function () {

                var webid = 0;
                Config.saveConfig(webid, function () {
                    // 新版本统计代码保存
                    kefu_file();
                });

            });
            getConfig(0);
            $("#nav").find('span').click(function(){
                Product.changeTab(this,'.product-add-div');//导航切换
            })
            $("#nav").find('span').first().trigger('click');
        });

        // 新版本客服代码保存
        function kefu_file() {
            $.ajax(
                {
                    type: "post",
                    url: SITEURL + 'systemparts/ajax_kefu_file',
                    dataType: 'json',
                    beforeSend: function () {
                        // ST.Util.showMsg('正在完成后续处理,请稍后...', 6, 60000);
                    },
                    success: function (data) {
                        if (data.status) {
                            ST.Util.showMsg('处理成功', 4, 1000);
                        }
                    }

                }
            );
        }

        //获取配置
        function getConfig(webid) {
            var fields = 'cfg_m_html_kefu';
            Config.getConfig(webid, function (data) {
                $("#cfg_html_kefu").val(data.cfg_m_html_kefu);
            }, fields)

        }
    </script>

</body>
</html>
